﻿package mortal.game.view.group
{
    import Message.Public.*;
    import com.mui.controls.*;
    import com.mui.core.*;
    import flash.events.*;
    import flash.text.*;
    import mortal.common.font.*;
    import mortal.game.cache.*;
    import mortal.game.events.*;
    import mortal.game.manager.*;
    import mortal.game.mvc.*;
    import mortal.game.resource.*;
    import mortal.game.view.common.*;
    import mortal.mvc.core.*;

    public class GroupSmallIcon extends HintBaseIcon
    {
        private var _inviteNum:GTextFiled;
        private static var _tabIndex:int;
        private static var _sGroupCopyInvite:SGroupCopyInvite;
        private static var _instance:GroupSmallIcon;

        public function GroupSmallIcon()
        {
            super(ImagesConst.SpriteTipIcon);
            this.layer = LayerManager.smallIconLayer;
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            var _loc_1:* = new TextFormat(FontUtil.defaultName, 9, 16777215);
            this._inviteNum = UIFactory.gTextField("", 19, 11, 20, 20, this, _loc_1);
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            this._inviteNum.dispose(param1);
            this._inviteNum = null;
            _tabIndex = 0;
            _sGroupCopyInvite = null;
            super.disposeImpl(param1);
            return;
        }// end function

        private function setIconAndNum() : void
        {
            var _loc_1:String = null;
            switch(_tabIndex)
            {
                case 3:
                {
                    _loc_1 = ImagesConst.GroupHintIcon;
                    this._inviteNum.text = Cache.instance.group.applyList.length.toString();
                    break;
                }
                case 4:
                {
                    _loc_1 = ImagesConst.guild_yaoIcon;
                    this._inviteNum.text = Cache.instance.group.inviteList.length.toString();
                    break;
                }
                default:
                {
                    break;
                }
            }
            _icon.bitmapData = GlobalClass.getBitmapData(_loc_1);
            return;
        }// end function

        override protected function clickHandler(event:MouseEvent) : void
        {
            if (!GameController.group.isViewShow)
            {
                GameManager.instance.popupModuleType(ModuleType.Group);
            }
            Dispatcher.dispatchEvent(new DataEvent(EventName.GroupTabIndexChange, _tabIndex));
            GroupSmallIcon.instance.hide();
            return;
        }// end function

        override public function show(param1:int = 0, param2:int = 0) : void
        {
            super.show();
            this.setIconAndNum();
            return;
        }// end function

        public static function get instance() : GroupSmallIcon
        {
            if (!_instance)
            {
                _instance = new GroupSmallIcon;
            }
            return _instance;
        }// end function

        public static function set tabIndex(param1:int) : void
        {
            _tabIndex = param1;
            return;
        }// end function

        public static function set sGroupCopyInvite(param1:SGroupCopyInvite) : void
        {
            _sGroupCopyInvite = param1;
            return;
        }// end function

    }
}
